package com.yan_jiu_sheng.LeetCodeHot100.AC;

/**
 * https://leetcode.cn/problems/climbing-stairs/description/?envType=study-plan-v2&envId=top-100-liked
 * 动态规划 类似于数学归纳法
 * 自我AC
 *
 * @author yulongTian
 * @create 2024-07-20 10:35
 */
public class Test77 {
    public static void main(String[] args) {

    }


    public int climbStairs(int n) {
        if (n == 1 || n == 2) {
            return n;
        }
        int f1 = 1;
        int f2 = 2;
        int f3 = 0;
        for (int i = 2; i < n; i++) {
            f3 = f1 + f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }


}
